#include<iostream>
using namespace std;
const int N = 125;
int arr[N][N];
int sum[N][N];
int n;
int main()
{
	cin >> n;
	for (int i = 1; i < n + 1; i++) {
		for (int j = 1; j < n + 1; j++) {
			cin >> arr[i][j];
			sum[i][j] = sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1] + arr[i][j];
		}
	}
	int ma = -10000;
	for (int x1 = 1; x1 < n + 1; x1++) {
		for (int y1 = 1; y1 < n + 1; y1++) {
			for (int x2 = 1; x2 < n + 1; x2++) {
				for (int y2 = 1; y2 < n + 1; y2++) {	
					if (x2 < x1 || y2 < y1)continue;
					ma = max(ma, sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1]);
				}
			}
		}
	}
	cout << ma << endl;
	return 0;
}